import "package:flutter/material.dart";

import '../../../widget/calendar1/flutter_custom_calendar.dart';

class CalendarPage1 extends StatefulWidget {
    final String text;
    
    CalendarPage1({Key key, this.text}) : super(key: key);
    
    @override
    _CalendarPage1State createState() => _CalendarPage1State();
}

class _CalendarPage1State extends State<CalendarPage1> {
    CalendarController controller;
    
    void initState() {
        print('initState-------');
        controller = CalendarController(
            selectMode: Constants.MODE_SINGLE_SELECT,
            /*weekBarItemWidgetBuilder: () {
                return Container(
                    child: Text('WeekBar'),
                );
            }*/
        );
        controller.addOnCalendarSelectListener((date) {
            print(date);
        });
        controller.addMonthChangeListener((year, month) {},);
        
        controller.addOnCalendarSelectListener((dateModel) {});
    }
    
    @override
    Widget build(BuildContext context) {
        print('build-------');
        return Scaffold(
            appBar: PreferredSize(
                preferredSize: Size.fromHeight(36.0),
                child: AppBar(
                    centerTitle: true,
                    elevation: 0.5,
                    titleSpacing: 0.0,
                    title: Text(widget.text),
                ),
            ),
            body: CalendarViewWidget(calendarController: controller),
        );;
    }
}